﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Business;
namespace GestorEventos
{
    public partial class addArtista : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int status;

            if (Session["userID"] == null) {
                
                Response.Redirect("Default.aspx");
            }
        }

        protected void adicionaArtista(Object o, EventArgs e) {
            bool flagNome = true;
            bool flagLink = true;
            ControlErros ce = new ControlErros();

            String nome = TextBoxNome.Text;
            /*flagNome = ce.controlNomeUtilizador(nome);
            if (!flagNome) { 
                // Tratar erro
            }*/
            
            String link = TextBoxLink.Text;
            
            /*flagLink = ce.controlLink(link);
            if (!flagLink)
            {
                // Tratar erro
            }*/

            String descricao = TextBoxDescricao.Text;

            /*if (flagLink && flagNome) {*/
                Artista art = new Artista(nome, descricao, link);
                
                
                if (art.insereArtista() != -1) {
                    Response.Redirect("viewArtista.aspx?artistID=" + art.getIDArtista() + "");
                }
            }

        
        }

        
    }

